package utilitarios;

import java.awt.Point;
import java.awt.event.MouseEvent;

/**
 *
 * @author WELISSON
 */
public class MoveTelas {
    
    private int xMouseOld;
    private int yMouseOld;
    
    //recebe a posicao em que o mouse clicou na tela.
    public void mouseClicado(MouseEvent evt){
        xMouseOld = evt.getX();    
        yMouseOld = evt.getY();
        
    }
    
    //seta as novas posiçoes conforme o mouse se movimenta
    public Point mouseMovido(MouseEvent evt){
        int xMouseNew = evt.getXOnScreen()- xMouseOld;  
        int yMouseNew = evt.getYOnScreen()- yMouseOld; 
        
        Point posicaoNova = new Point(xMouseNew, yMouseNew);
        return posicaoNova;
    }
    
}
